The neighborhood vulnerability index is XYZ and uses multiple data sources to assess XYZ. Add more here.
About the index:
Data sources:
---
title: "Socioeconomic Factors and Homelessness"
output:
flexdashboard::flex_dashboard:
# logo: logo.png
orientation: columns
vertical_layout: fill
social: menu
source_code: embed
theme: readable
---
```{r setup, include=T}
library(ggiraph)
library(tidyverse)
library(gfonts)
library(gt)
library(sf)
library(flextable)
library(tigris)
library(cowplot)
library(patchwork)
library(leaflet)
tooltip_css <- "font-size:20px;padding:2px 4px 2px 4px;background:black;color:white;border-radius:2px 2px 2px 2px;"
```
```{r setup-data, include=F}
# travis_tracts <- read_sf('counts_with_census_indicators.shp')
dfs_merged <- read_csv('counts_with_census_indicators.csv')
tract_counts_08172022 <- read_csv('tract_CA_counts_08172022.csv') %>%
rename(GEOID = TRACT)
dfs_merged_with_newcounts <- dfs_merged %>%
inner_join(tract_counts_08172022)
# cor.test(dfs_merged_with_newcounts$Counts, dfs_merged_with_newcounts$TotalCount)
# t <- dfs_merged %>%
# mutate(Tract = as.character(GEOID)) %>%
# arrange(desc(Counts))
# using new CA counts
dfs_condensed <- dfs_merged_with_newcounts %>%
dplyr::select(GEOID, total_pop, TotalCount, percent_wo_health_insurance, percent_reporting_bad_mental_health, poverty_rate, Percent_Unemployed, gentrifying_dummy, rent_burden, filing_rate_5yr, percent_overcrowded_rentals, percent_hispanic, percent_nhblack, percent_nhwhite, units_per_sqmi, avg_monthly_reports_per_1k, civic_orgs_per1k, social_service_orgs_per1k, rel_orgs_per1k)
df_no_missing <- dfs_condensed %>%
na.omit()
df_no_missing_nogeoid <- df_no_missing %>%
dplyr::select(-GEOID)
# fa_test <- factanal(df_no_missing_nogeoid, factors = 4, rotation = 'varimax')
#
# fa_test$loadings
dfs_scaled <- dfs_condensed %>%
dplyr::select(-GEOID) %>%
mutate(across(where(is.numeric), scale))
dfs_scaled_index <- dfs_scaled %>%
dplyr::select(TotalCount, percent_wo_health_insurance, percent_reporting_bad_mental_health, poverty_rate, Percent_Unemployed, gentrifying_dummy, rent_burden, filing_rate_5yr, percent_overcrowded_rentals, percent_hispanic, percent_nhblack, percent_nhwhite, units_per_sqmi, avg_monthly_reports_per_1k, social_service_orgs_per1k)
dfs_scaled_index$TotalCount <- dfs_scaled_index$TotalCount*.520
dfs_scaled_index$percent_wo_health_insurance <- dfs_scaled_index$percent_wo_health_insurance*.909
dfs_scaled_index$percent_reporting_bad_mental_health <- dfs_scaled_index$percent_reporting_bad_mental_health*.703
# dfs_scaled_index$Percent_Disability <- dfs_scaled_index$Percent_Disability*.329
dfs_scaled_index$poverty_rate <- dfs_scaled_index$poverty_rate*.520
dfs_scaled_index$Percent_Unemployed <- dfs_scaled_index$Percent_Unemployed*.300
dfs_scaled_index$gentrifying_dummy <- dfs_scaled_index$gentrifying_dummy*.367
dfs_scaled_index$rent_burden <- dfs_scaled_index$rent_burden*.273
dfs_scaled_index$filing_rate_5yr <- dfs_scaled_index$filing_rate_5yr*.689
dfs_scaled_index$percent_overcrowded_rentals <- dfs_scaled_index$percent_overcrowded_rentals*.467
dfs_scaled_index$percent_hispanic <- dfs_scaled_index$percent_hispanic*.976
dfs_scaled_index$percent_nhblack <- dfs_scaled_index$percent_nhblack*.352
dfs_scaled_index$percent_nhwhite <- dfs_scaled_index$percent_nhwhite*-.893
# dfs_scaled_index$units_per_sqmi <- dfs_scaled_index$units_per_sqmi*-.117
dfs_scaled_index$avg_monthly_reports_per_1k <- dfs_scaled_index$avg_monthly_reports_per_1k*.210
dfs_scaled_index$social_service_orgs_per1k <- dfs_scaled_index$social_service_orgs_per1k*-.175
dfs_scaled_index <- dfs_scaled_index %>%
replace(is.na(.),0) %>%
mutate(index = rowSums(.))
tracts <- tracts(state = 'TX', county = 'Travis', year = '2019') %>%
dplyr::select(GEOID) %>%
mutate(GEOID = as.numeric(GEOID))
dfs_scaled_index_withGEOID <- cbind(dfs_scaled_index, dfs_condensed[c("GEOID")])
dfs_scaled_index_withGEOID <- cbind(dfs_scaled_index_withGEOID, dfs_merged[("Name.x")])
tracts_with_index <- tracts %>%
inner_join(dfs_scaled_index_withGEOID)
tracts_with_index$NewIndex =cut(tracts_with_index$index, breaks = classInt::classIntervals(tracts_with_index$index, n = 5, style = 'fisher')$brks, labels = FALSE)
tracts_with_index <- tracts_with_index %>%
st_transform(crs = 4326) %>%
# mutate(Vulnerability = as.factor(NewIndex))
rename(Vulnerability = NewIndex)
tracts_sf_index_orig_data <- tracts_with_index %>%
select(GEOID, Name.x, Vulnerability) %>%
inner_join(dfs_condensed)
# names(tracts_with_index)
# flextable part -----
# fun_flextable <- function(dat){
# ft <- flextable(dat, col_keys = c("Name.x", "Vulnerability", "percent_wo_health_insurance"),
# defaults = list(fontname = "Roboto") )
# ft <- bold(ft, part = "header", bold = TRUE)
# ft <- color(ft, color = "blue", part = "all")
# ft <- set_table_properties(ft, layout = "autofit")
# as.character(htmltools_value(ft, ft.shadow = FALSE))
# }
# temp_dat <- as.data.frame(tracts_sf_index_orig_data)[,c("Name.x", "Vulnerability", "percent_wo_health_insurance")]
#
# u <- t(temp_dat)
#
# temp_dat <- split(temp_dat, seq_len(nrow(temp_dat)))
# tracts_sf_index_orig_data$tooltip <- map_chr(temp_dat, fun_flextable)
# # end of flextable part
#
# test_ft <- flextable(tracts_with_index)
#
# test_ft
tracts_map <- tracts_sf_index_orig_data %>%
ggplot() +
geom_sf(data = tracts_sf_index_orig_data, color="#dddddd", fill="#f2f2f2", lwd=.3) +
geom_sf_interactive(aes(fill=Vulnerability, tooltip=tooltip, data_id = Name.x), lwd=.3) +
# scale_fill_gradientn(colours = tinter("#5da5da", steps = 5), labels = function(x) paste0(x,"Cases")) +
coord_sf(datum=NA)
tracts_sf_index_orig_data <- tracts_sf_index_orig_data %>%
mutate(log_counts = log(TotalCount),
counts_per_capita = TotalCount/total_pop,
log_counts_per_capita = TotalCount/total_pop,
Gentrifying = ifelse(gentrifying_dummy == 1, 'Yes', 'No'))
```
Vulnerability Index Map {data-navmenu="Explore"}
=====================================
Column {data-width=150}
-------------------------------------
### About This Index
The neighborhood vulnerability index is XYZ and uses multiple data sources to assess XYZ. **Add more here.**
Column {data-width=650}
-------------------------------------
### Travis County Neighborhood Vulnerability Index
```{r map,echo=F}
# girafe(ggobj = tracts_map, width_svg = 10, height_svg = 5,
# options = list(
# opts_tooltip(css = "padding:5px;background:white;border-radius:2px 2px 2px 2px;"),
# opts_hover_inv(css = "opacity:0.5;"),
# opts_hover(css = "stroke-width:2;")
# ))
pal <- colorFactor(palette = "BuGn", domain = tracts_sf_index_orig_data$Vulnerability)
area_popup <- paste0("<b>Census Tract:</b> ", tracts_sf_index_orig_data$Name.x,
"<br><b>Vulnerability:</b> ", tracts_sf_index_orig_data$Vulnerability,
"<br><b>Eviction Rate:</b> ", tracts_sf_index_orig_data$filing_rate_5yr,
'<br><b>Pct Uninsured:</b> ', tracts_sf_index_orig_data$percent_wo_health_insurance,
'<br><b>Rent Burden:</b> ', tracts_sf_index_orig_data$rent_burden) %>%
lapply(htmltools::HTML)
leaflet(tracts_sf_index_orig_data) %>%
setView(-97.726871, 30.307905, zoom = 10) %>%
addProviderTiles(providers$Stamen.TonerLite, group = "Toner Lite") %>%
addProviderTiles(providers$Stamen.Toner, group = "Toner") %>%
addProviderTiles(providers$CartoDB.Positron, group = "CartoDB") %>%
addPolygons(fillColor = ~pal(Vulnerability),
fillOpacity = 0.9,
opacity = 1,
color = "black",
weight = 1,
label = ~area_popup,
labelOptions = labelOptions(
style = list("font-weight" = "normal", padding = "3px 8px"),
textsize = "15px",
direction = "auto"),
group = "Vulnerability",
highlight = highlightOptions(color = "white",
weight = 0.1)) %>%
addLegend(data = tracts_sf_index_orig_data,
position = "bottomright",
pal = pal,
values = ~Vulnerability,
title = "Neighborhood Vulnerability",
group = "Neighborhood Vulnerability") %>%
# Layers control
addLayersControl(
baseGroups = c("Toner Lite", "Toner", "CartoDB"),
overlayGroups = "Vulnerability",
options = layersControlOptions(collapsed = FALSE)
)
```
Rent and Homelessness {data-navmenu="Explore"}
=========================================
Column
-----------------------------------------
### Rent Burden and Overcrowded Rental Units
```{r rent-plots, echo=F}
rent_burden_homelessness_scatter <- tracts_sf_index_orig_data %>%
filter(filing_rate_5yr < 10) %>%
ggplot(mapping = aes(x = rent_burden, y = counts_per_capita)) +
geom_point_interactive(
aes(tooltip = Name.x,
data_id = GEOID),
na.rm = TRUE, size = 1.25,
color = "#08519c", fill = "#0072B280"
) +
geom_smooth(method = 'lm', se = F, linetype = 2, size = .5, color = 'black') +
labs(x = "Rent Burden",
y = "Homelessness Rate") +
theme_minimal_grid() +
theme(axis.text = element_text(size = 6),
axis.title = element_text(size = 7))
overcrowded_homelessness_scatter <- tracts_sf_index_orig_data %>%
filter(filing_rate_5yr < 10) %>%
ggplot(mapping = aes(x = percent_overcrowded_rentals, y = counts_per_capita)) +
geom_point_interactive(
aes(tooltip = Name.x,
data_id = GEOID),
na.rm = TRUE, size = 1.25,
color = "#08519c", fill = "#0072B280"
) +
geom_smooth(method = 'lm', se = F, linetype = 2, size = .5, color = 'black') +
labs(x = "Pct in Overcrowded Rental Unit",
y = "Homelessness Rate") +
theme_minimal_grid() +
theme(axis.text = element_text(size = 6),
axis.title = element_text(size = 7))
just_vulnerability_map <- tracts_sf_index_orig_data %>%
filter(filing_rate_5yr < 10) %>%
ggplot(aes(fill = Vulnerability)) +
geom_sf_interactive(
aes(
tooltip = Name.x,
data_id = GEOID
),
size = 0.2, color = "black"
) +
theme_void() +
scale_fill_distiller(palette = 'BuGn', direction = 1)
# scale_fill_viridis_c()
# eviction_map
# rent_burden_homelessness_scatter
# scatterplots <- plot_grid(eviction_homelessness_scatter, rent_burden_homelessness_scatter, ncol = 1, align = "v",
# rel_heights = c(1,1),
# rel_widths = c(1,1))
#
# scatterplots
# patch_plot <- ((eviction_homelessness_scatter / rent_burden_homelessness_scatter) | eviction_map) + plot_layout(widths = c(1,1.2))
#
# layout <- c(
# area(1, 1),
# area(2, 2),
# area(1, 3)
# )
#
# # plot(layout)
#
# test_patch <- (eviction_homelessness_scatter + plot_spacer() + rent_burden_homelessness_scatter) / (plot_spacer() + eviction_map + plot_spacer()) + plot_layout(heights = c(.75,1))
#
# test_patch_v2 <- eviction_homelessness_scatter + eviction_map + rent_burden_homelessness_scatter + plot_layout(design = layout)
patch_rent_plot <- rent_burden_homelessness_scatter + just_vulnerability_map + overcrowded_homelessness_scatter
# test_patch
# patch_plot
# rent_burden_homelessness_scatter
# eviction_homelessness_scatter
# test_patch_v2
# eviction_map
girafe(
ggobj = patch_rent_plot,
height_svg = 5,
width_svg = 12,
options = list(
opts_sizing(rescale = TRUE),
opts_zoom(max = 5),
opts_tooltip(css = tooltip_css, delay_mouseover = 0, delay_mouseout = 0),
opts_hover(css = "fill: #E69F00; fill-opacity: 1.0; stroke: #E69F00;")
)
)
```
Other Housing Indicators and Homelessness {data-navmenu="Explore"}
=========================================
Column
-----------------------------------------
### Evictions and Gentrification
```{r housing-plots, echo=F}
eviction_homelessness_scatter <- tracts_sf_index_orig_data %>%
filter(filing_rate_5yr < 10) %>%
ggplot(mapping = aes(x = filing_rate_5yr, y = counts_per_capita)) +
geom_point_interactive(
aes(tooltip = Name.x,
data_id = GEOID),
na.rm = TRUE, size = 1.25,
color = "#08519c", fill = "#0072B280"
) +
geom_smooth(method = 'lm', se = F, linetype = 2, size = .5, color = 'black') +
labs(x = "Eviction Filing Rate",
y = "Homelessness Rate") +
theme_minimal_grid() +
theme(axis.text = element_text(size = 6),
axis.title = element_text(size = 7))
gentrifying_homelessness_scatter <- tracts_sf_index_orig_data %>%
filter(filing_rate_5yr < 10,
!is.na(Gentrifying)) %>%
ggplot(mapping = aes(x = as.factor(Gentrifying), y = counts_per_capita)) +
geom_boxplot(size = .5,
outlier.shape = NA) +
geom_jitter_interactive(
aes(tooltip = Name.x,
data_id = GEOID),
na.rm = TRUE, size = 1.25,
color = "#08519c", fill = "#0072B280"
) +
labs(x = "Gentrifying",
y = "Homelessness Rate") +
theme_minimal_grid() +
theme(axis.text = element_text(size = 6),
axis.title = element_text(size = 7))
just_vulnerability_map <- tracts_sf_index_orig_data %>%
filter(filing_rate_5yr < 10) %>%
ggplot(aes(fill = Vulnerability)) +
geom_sf_interactive(
aes(
tooltip = Name.x,
data_id = GEOID
),
size = 0.2, color = "black"
) +
theme_void() +
scale_fill_distiller(palette = 'BuGn', direction = 1)
# gentrifying_homelessness_scatter
# scale_fill_viridis_c()
# eviction_map
# rent_burden_homelessness_scatter
# scatterplots <- plot_grid(eviction_homelessness_scatter, rent_burden_homelessness_scatter, ncol = 1, align = "v",
# rel_heights = c(1,1),
# rel_widths = c(1,1))
#
# scatterplots
# patch_plot <- ((eviction_homelessness_scatter / rent_burden_homelessness_scatter) | eviction_map) + plot_layout(widths = c(1,1.2))
#
# layout <- c(
# area(1, 1),
# area(2, 2),
# area(1, 3)
# )
#
# # plot(layout)
#
# test_patch <- (eviction_homelessness_scatter + plot_spacer() + rent_burden_homelessness_scatter) / (plot_spacer() + eviction_map + plot_spacer()) + plot_layout(heights = c(.75,1))
#
# test_patch_v2 <- eviction_homelessness_scatter + eviction_map + rent_burden_homelessness_scatter + plot_layout(design = layout)
patch_hsg_plot <- eviction_homelessness_scatter + just_vulnerability_map + gentrifying_homelessness_scatter
# test_patch
# patch_plot
# rent_burden_homelessness_scatter
# eviction_homelessness_scatter
# test_patch_v2
# eviction_map
girafe(
ggobj = patch_hsg_plot,
height_svg = 5,
width_svg = 12,
options = list(
opts_sizing(rescale = TRUE),
opts_zoom(max = 5),
opts_tooltip(css = tooltip_css, delay_mouseover = 0, delay_mouseout = 0),
opts_hover(css = "fill: #E69F00; fill-opacity: 1.0; stroke: #E69F00;")
)
)
```
Health Indicators and Homelessness {data-navmenu="Explore"}
=========================================
Column
-----------------------------------------
### Health Insurance and Mental Health
```{r health-plots, echo=F}
insurance_homelessness_scatter <- tracts_sf_index_orig_data %>%
filter(filing_rate_5yr < 10) %>%
ggplot(mapping = aes(x = percent_wo_health_insurance, y = counts_per_capita)) +
geom_point_interactive(
aes(tooltip = Name.x,
data_id = GEOID),
na.rm = TRUE, size = 1.25,
color = "#08519c", fill = "#0072B280"
) +
geom_smooth(method = 'lm', se = F, linetype = 2, size = .5, color = 'black') +
labs(x = "Pct Without Health Insurance",
y = "Homelessness Rate") +
theme_minimal_grid() +
theme(axis.text = element_text(size = 6),
axis.title = element_text(size = 7))
mental_health_homelessness_scatter <- tracts_sf_index_orig_data %>%
filter(filing_rate_5yr < 10) %>%
ggplot(mapping = aes(x = percent_reporting_bad_mental_health, y = counts_per_capita)) +
geom_point_interactive(
aes(tooltip = Name.x,
data_id = GEOID),
na.rm = TRUE, size = 1.25,
color = "#08519c", fill = "#0072B280"
) +
geom_smooth(method = 'lm', se = F, linetype = 2, size = .5, color = 'black') +
labs(x = "Pct Reporting Bad Mental Health",
y = "Homelessness Rate") +
theme_minimal_grid() +
theme(axis.text = element_text(size = 6),
axis.title = element_text(size = 7))
just_vulnerability_map <- tracts_sf_index_orig_data %>%
filter(filing_rate_5yr < 10) %>%
ggplot(aes(fill = Vulnerability)) +
geom_sf_interactive(
aes(
tooltip = Name.x,
data_id = GEOID
),
size = 0.2, color = "black"
) +
theme_void() +
scale_fill_distiller(palette = 'BuGn', direction = 1)
# scale_fill_viridis_c()
# eviction_map
# rent_burden_homelessness_scatter
# scatterplots <- plot_grid(eviction_homelessness_scatter, rent_burden_homelessness_scatter, ncol = 1, align = "v",
# rel_heights = c(1,1),
# rel_widths = c(1,1))
#
# scatterplots
# patch_plot <- ((eviction_homelessness_scatter / rent_burden_homelessness_scatter) | eviction_map) + plot_layout(widths = c(1,1.2))
#
# layout <- c(
# area(1, 1),
# area(2, 2),
# area(1, 3)
# )
#
# # plot(layout)
#
# test_patch <- (eviction_homelessness_scatter + plot_spacer() + rent_burden_homelessness_scatter) / (plot_spacer() + eviction_map + plot_spacer()) + plot_layout(heights = c(.75,1))
#
# test_patch_v2 <- eviction_homelessness_scatter + eviction_map + rent_burden_homelessness_scatter + plot_layout(design = layout)
patch_health_plots <- insurance_homelessness_scatter + just_vulnerability_map + mental_health_homelessness_scatter
# test_patch
# patch_plot
# rent_burden_homelessness_scatter
# eviction_homelessness_scatter
# test_patch_v2
# eviction_map
girafe(
ggobj = patch_health_plots,
height_svg = 5,
width_svg = 12,
options = list(
opts_sizing(rescale = TRUE),
opts_zoom(max = 5),
opts_tooltip(css = tooltip_css, delay_mouseover = 0, delay_mouseout = 0),
opts_hover(css = "fill: #E69F00; fill-opacity: 1.0; stroke: #E69F00;")
)
)
```
Poverty and Homelessness {data-navmenu="Explore"}
=========================================
Column
-----------------------------------------
### Poverty and Unemployment Rate
```{r poverty-plots, echo=F}
poverty_homelessness_scatter <- tracts_sf_index_orig_data %>%
filter(filing_rate_5yr < 10) %>%
ggplot(mapping = aes(x = poverty_rate, y = counts_per_capita)) +
geom_point_interactive(
aes(tooltip = Name.x,
data_id = GEOID),
na.rm = TRUE, size = 1.25,
color = "#08519c", fill = "#0072B280"
) +
geom_smooth(method = 'lm', se = F, linetype = 2, size = .5, color = 'black') +
labs(x = "Poverty Rate",
y = "Homelessness Rate") +
theme_minimal_grid() +
theme(axis.text = element_text(size = 6),
axis.title = element_text(size = 7))
unemployment_homelessness_scatter <- tracts_sf_index_orig_data %>%
filter(filing_rate_5yr < 10) %>%
ggplot(mapping = aes(x = Percent_Unemployed, y = counts_per_capita)) +
geom_point_interactive(
aes(tooltip = Name.x,
data_id = GEOID),
na.rm = TRUE, size = 1.25,
color = "#08519c", fill = "#0072B280"
) +
geom_smooth(method = 'lm', se = F, linetype = 2, size = .5, color = 'black') +
labs(x = "Unemployment Rate",
y = "Homelessness Rate") +
theme_minimal_grid() +
theme(axis.text = element_text(size = 6),
axis.title = element_text(size = 7))
just_vulnerability_map <- tracts_sf_index_orig_data %>%
filter(filing_rate_5yr < 10) %>%
ggplot(aes(fill = Vulnerability)) +
geom_sf_interactive(
aes(
tooltip = Name.x,
data_id = GEOID
),
size = 0.2, color = "black"
) +
theme_void() +
scale_fill_distiller(palette = 'BuGn', direction = 1)
# scale_fill_viridis_c()
# eviction_map
# rent_burden_homelessness_scatter
# scatterplots <- plot_grid(eviction_homelessness_scatter, rent_burden_homelessness_scatter, ncol = 1, align = "v",
# rel_heights = c(1,1),
# rel_widths = c(1,1))
#
# scatterplots
# patch_plot <- ((eviction_homelessness_scatter / rent_burden_homelessness_scatter) | eviction_map) + plot_layout(widths = c(1,1.2))
#
# layout <- c(
# area(1, 1),
# area(2, 2),
# area(1, 3)
# )
#
# # plot(layout)
#
# test_patch <- (eviction_homelessness_scatter + plot_spacer() + rent_burden_homelessness_scatter) / (plot_spacer() + eviction_map + plot_spacer()) + plot_layout(heights = c(.75,1))
#
# test_patch_v2 <- eviction_homelessness_scatter + eviction_map + rent_burden_homelessness_scatter + plot_layout(design = layout)
patch_poverty_plots <- poverty_homelessness_scatter + just_vulnerability_map + unemployment_homelessness_scatter
# test_patch
# patch_plot
# rent_burden_homelessness_scatter
# eviction_homelessness_scatter
# test_patch_v2
# eviction_map
girafe(
ggobj = patch_poverty_plots,
height_svg = 5,
width_svg = 12,
options = list(
opts_sizing(rescale = TRUE),
opts_zoom(max = 5),
opts_tooltip(css = tooltip_css, delay_mouseover = 0, delay_mouseout = 0),
opts_hover(css = "fill: #E69F00; fill-opacity: 1.0; stroke: #E69F00;")
)
)
```
Race, Ethnicity, and Homelessness {data-navmenu="Explore"}
=========================================
Column
-----------------------------------------
### Race and Ethnicity
```{r race-plots, echo=F}
black_homelessness_scatter <- tracts_sf_index_orig_data %>%
filter(filing_rate_5yr < 10) %>%
ggplot(mapping = aes(x = percent_nhblack, y = counts_per_capita)) +
geom_point_interactive(
aes(tooltip = Name.x,
data_id = GEOID),
na.rm = TRUE, size = 1.25,
color = "#08519c", fill = "#0072B280"
) +
geom_smooth(method = 'lm', se = F, linetype = 2, size = .5, color = 'black') +
labs(x = "Pct Black",
y = "Homelessness Rate") +
theme_minimal_grid() +
theme(axis.text = element_text(size = 6),
axis.title = element_text(size = 7))
hispanic_homelessness_scatter <- tracts_sf_index_orig_data %>%
filter(filing_rate_5yr < 10) %>%
ggplot(mapping = aes(x = percent_hispanic, y = counts_per_capita)) +
geom_point_interactive(
aes(tooltip = Name.x,
data_id = GEOID),
na.rm = TRUE, size = 1.25,
color = "#08519c", fill = "#0072B280"
) +
geom_smooth(method = 'lm', se = F, linetype = 2, size = .5, color = 'black') +
labs(x = "Pct Hispanic",
y = "Homelessness Rate") +
theme_minimal_grid() +
theme(axis.text = element_text(size = 6),
axis.title = element_text(size = 7))
just_vulnerability_map <- tracts_sf_index_orig_data %>%
filter(filing_rate_5yr < 10) %>%
ggplot(aes(fill = Vulnerability)) +
geom_sf_interactive(
aes(
tooltip = Name.x,
data_id = GEOID
),
size = 0.2, color = "black"
) +
theme_void() +
scale_fill_distiller(palette = 'BuGn', direction = 1)
# scale_fill_viridis_c()
# eviction_map
# rent_burden_homelessness_scatter
# scatterplots <- plot_grid(eviction_homelessness_scatter, rent_burden_homelessness_scatter, ncol = 1, align = "v",
# rel_heights = c(1,1),
# rel_widths = c(1,1))
#
# scatterplots
# patch_plot <- ((eviction_homelessness_scatter / rent_burden_homelessness_scatter) | eviction_map) + plot_layout(widths = c(1,1.2))
#
# layout <- c(
# area(1, 1),
# area(2, 2),
# area(1, 3)
# )
#
# # plot(layout)
#
# test_patch <- (eviction_homelessness_scatter + plot_spacer() + rent_burden_homelessness_scatter) / (plot_spacer() + eviction_map + plot_spacer()) + plot_layout(heights = c(.75,1))
#
# test_patch_v2 <- eviction_homelessness_scatter + eviction_map + rent_burden_homelessness_scatter + plot_layout(design = layout)
patch_race_plots <- black_homelessness_scatter + just_vulnerability_map + hispanic_homelessness_scatter
# test_patch
# patch_plot
# rent_burden_homelessness_scatter
# eviction_homelessness_scatter
# test_patch_v2
# eviction_map
girafe(
ggobj = patch_race_plots,
height_svg = 5,
width_svg = 12,
options = list(
opts_sizing(rescale = TRUE),
opts_zoom(max = 5),
opts_tooltip(css = tooltip_css, delay_mouseover = 0, delay_mouseout = 0),
opts_hover(css = "fill: #E69F00; fill-opacity: 1.0; stroke: #E69F00;")
)
)
```
Social Support and Homelessness {data-navmenu="Explore"}
=========================================
Column
-----------------------------------------
### Social Service and Civic Organizations
```{r social-plots, echo=F}
social_homelessness_scatter <- tracts_sf_index_orig_data %>%
filter(filing_rate_5yr < 10,
social_service_orgs_per1k < 10) %>%
ggplot(mapping = aes(x = social_service_orgs_per1k, y = counts_per_capita)) +
geom_point_interactive(
aes(tooltip = Name.x,
data_id = GEOID),
na.rm = TRUE, size = 1.25,
color = "#08519c", fill = "#0072B280"
) +
geom_smooth(method = 'lm', se = F, linetype = 2, size = .5, color = 'black') +
labs(x = "Social Service Orgs Per 1000 People",
y = "Homelessness Rate") +
theme_minimal_grid() +
theme(axis.text = element_text(size = 6),
axis.title = element_text(size = 7))
# social_homelessness_scatter
civic_homelessness_scatter <- tracts_sf_index_orig_data %>%
filter(filing_rate_5yr < 10,
civic_orgs_per1k < 5) %>%
ggplot(mapping = aes(x = civic_orgs_per1k, y = counts_per_capita)) +
geom_point_interactive(
aes(tooltip = Name.x,
data_id = GEOID),
na.rm = TRUE, size = 1.25,
color = "#08519c", fill = "#0072B280"
) +
geom_smooth(method = 'lm', se = F, linetype = 2, size = .5, color = 'black') +
labs(x = "Civic Orgs Per 1000 People",
y = "Homelessness Rate") +
theme_minimal_grid() +
theme(axis.text = element_text(size = 6),
axis.title = element_text(size = 7))
# civic_homelessness_scatter
just_vulnerability_map <- tracts_sf_index_orig_data %>%
filter(filing_rate_5yr < 10) %>%
ggplot(aes(fill = Vulnerability)) +
geom_sf_interactive(
aes(
tooltip = Name.x,
data_id = GEOID
),
size = 0.2, color = "black"
) +
theme_void() +
scale_fill_distiller(palette = 'BuGn', direction = 1)
# scale_fill_viridis_c()
# eviction_map
# rent_burden_homelessness_scatter
# scatterplots <- plot_grid(eviction_homelessness_scatter, rent_burden_homelessness_scatter, ncol = 1, align = "v",
# rel_heights = c(1,1),
# rel_widths = c(1,1))
#
# scatterplots
# patch_plot <- ((eviction_homelessness_scatter / rent_burden_homelessness_scatter) | eviction_map) + plot_layout(widths = c(1,1.2))
#
# layout <- c(
# area(1, 1),
# area(2, 2),
# area(1, 3)
# )
#
# # plot(layout)
#
# test_patch <- (eviction_homelessness_scatter + plot_spacer() + rent_burden_homelessness_scatter) / (plot_spacer() + eviction_map + plot_spacer()) + plot_layout(heights = c(.75,1))
#
# test_patch_v2 <- eviction_homelessness_scatter + eviction_map + rent_burden_homelessness_scatter + plot_layout(design = layout)
patch_social_plots <- social_homelessness_scatter + just_vulnerability_map + civic_homelessness_scatter
# test_patch
# patch_plot
# rent_burden_homelessness_scatter
# eviction_homelessness_scatter
# test_patch_v2
# eviction_map
girafe(
ggobj = patch_social_plots,
height_svg = 5,
width_svg = 12,
options = list(
opts_sizing(rescale = TRUE),
opts_zoom(max = 5),
opts_tooltip(css = tooltip_css, delay_mouseover = 0, delay_mouseout = 0),
opts_hover(css = "fill: #E69F00; fill-opacity: 1.0; stroke: #E69F00;")
)
)
```
About {data-navmenu="Explore"}
=========================================
Column
-----------------------------------------
About the index:
Column
-----------------------------------------
Data sources:
Social Support and Homelessness
Column
Social Service and Civic Organizations